package com.mindskip.xzs.repository;

import com.mindskip.xzs.domain.UserToken;
import com.mindskip.xzs.repository.base.MyMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserTokenMapper extends MyMapper<UserToken> {
//    int deleteByPrimaryKey(Integer id);
//
//    int insert(UserToken record);
//
//    int insertSelective(UserToken record);
//
//    UserToken selectByPrimaryKey(Integer id);
//
//    int updateByPrimaryKeySelective(UserToken record);
//
//    int updateByPrimaryKey(UserToken record);

    String queryParams = " id, token, user_id userId, wx_open_id wxOpenId, create_time createTime, end_time endTime, user_name userName ";

    @Select("select\n" + queryParams +
            "    from t_user_token\n" +
            "    where token = #{token}\n" +
            "    order by id desc\n" +
            "    limit 1")
    UserToken getToken(@Param("token") String token);
}
